package com.ruoyi.web.controller.net;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.net.domain.BusiMplstpRouteElements;
import com.ruoyi.net.service.IBusiMplstpRouteElementsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 路由图网元（顺序）Controller
 * 
 * @author tony
 * @date 2024-12-04
 */
@Api(tags = "业务-mplstp-路由图网元（顺序）")
@RestController
@RequestMapping("/busi/mplstp/route/elements")
public class BusiMplstpRouteElementsController extends BaseController
{
    @Autowired
    private IBusiMplstpRouteElementsService busiMplstpRouteElementsService;

    /**
     * 查询路由图网元（顺序）列表
     */
    @ApiOperation(value = "查询路由图网元（顺序）列表", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:elements:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusiMplstpRouteElements busiMplstpRouteElements)
    {
        startPage();
        List<BusiMplstpRouteElements> list = busiMplstpRouteElementsService.selectBusiMplstpRouteElementsList(busiMplstpRouteElements);
        return getDataTable(list);
    }

    /**
     * 导出路由图网元（顺序）列表
     */
    @ApiOperation(value = "导出路由图网元（顺序）列表", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:elements:export')")
    @Log(title = "路由图网元（顺序）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusiMplstpRouteElements busiMplstpRouteElements)
    {
        List<BusiMplstpRouteElements> list = busiMplstpRouteElementsService.selectBusiMplstpRouteElementsList(busiMplstpRouteElements);
        ExcelUtil<BusiMplstpRouteElements> util = new ExcelUtil<BusiMplstpRouteElements>(BusiMplstpRouteElements.class);
        util.exportExcel(response, list, "路由图网元（顺序）数据");
    }

    /**
     * 获取路由图网元（顺序）详细信息
     */
    @ApiOperation(value = "获取路由图网元（顺序）详细信息", httpMethod = "GET")
    @PreAuthorize("@ss.hasPermi('net:elements:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busiMplstpRouteElementsService.selectBusiMplstpRouteElementsById(id));
    }

    /**
     * 新增路由图网元（顺序）
     */
    @ApiOperation(value = "新增路由图网元（顺序）", httpMethod = "POST")
    @PreAuthorize("@ss.hasPermi('net:elements:add')")
    @Log(title = "路由图网元（顺序）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusiMplstpRouteElements busiMplstpRouteElements)
    {
        return toAjax(busiMplstpRouteElementsService.insertBusiMplstpRouteElements(busiMplstpRouteElements));
    }

    /**
     * 修改路由图网元（顺序）
     */
    @ApiOperation(value = "修改路由图网元（顺序）", httpMethod = "PUT")
    @PreAuthorize("@ss.hasPermi('net:elements:edit')")
    @Log(title = "路由图网元（顺序）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusiMplstpRouteElements busiMplstpRouteElements)
    {
        return toAjax(busiMplstpRouteElementsService.updateBusiMplstpRouteElements(busiMplstpRouteElements));
    }

    /**
     * 删除路由图网元（顺序）
     */
    @ApiOperation(value = "删除路由图网元（顺序）", httpMethod = "DELETE")
    @PreAuthorize("@ss.hasPermi('net:elements:remove')")
    @Log(title = "路由图网元（顺序）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busiMplstpRouteElementsService.deleteBusiMplstpRouteElementsByIds(ids));
    }
}
